# eric7.PdfViewer.PdfViewerWindow

Module implementing the PDF viewer main window.

### Global Attributes

None

### Classes

PdfViewerWindow | Class implementing the PDF viewer main window.

### Functions

None

## PdfViewerWindow

Class implementing the PDF viewer main window.

### Signals

viewerClosed()
  emitted after the window was requested to close

### Derived from

EricMainWindow

### Class Attributes

maxMenuFilePathLen
windows

### Class Methods

None

### Methods

PdfViewerWindow | Constructor
__about | Private slot to show a little About message.
__aboutQt | Private slot to handle the About Qt dialog.
__addToRecentList | Private method to add a file name to the list of recently opened files.
__backInHistory | Private slot to go back in the view history.
__checkActions | Private slot to check some actions for their enable/disable status.
__clearRecent | Private method to clear the list of recently opened files.
__closeAll | Private slot to close all windows.
__closeOthers | Private slot to close all other windows.
__copyAllText | Private slot to copy all text of the document to the system clipboard.
__copyAllTextOfPage | Private slot to copy all text of the current page to the system clipboard.
__copyText | Private slot to copy the selected text to the system clipboard.
__createStatusBar | Private method to initialize the status bar.
__displayModeSelected | Private slot to handle the selection of a display mode.
__endDocument | Private slot to go to the last page of the document.
__forwardInHistory | Private slot to go forward in the view history.
__getErrorString | Private method to get an error string for the given error.
__gotoPage | Private slot to show a dialog to select a page to jump to.
__handleSearchResult | Private slot to handle the selection of a search result.
__initActions | Private method to define the user interface actions.
__initEditActions | Private method to create the Edit actions.
__initFileActions | Private method to define the file related user interface actions.
__initGotoActions | Private method to define the navigation related user interface actions.
__initHelpActions | Private method to create the Help actions.
__initMenus | Private method to create the menus.
__initSettingsActions | Private method to create the Settings actions.
__initToolbars | Private method to create the toolbars.
__initViewActions | Private method to define the view related user interface actions.
__loadPdfFile | Private method to load a PDF file.
__loadRecent | Private method to load the list of recently opened files.
__nextPage | Private slot to go to the next page.
__openPdfFile | Private slot to open a PDF file.
__openPdfFileNewWindow | Private slot called to open a PDF file in new viewer window.
__openRecentPdfFile | Private method to open a file from the list of recently opened files.
__pageSelected | Private slot to navigate to the given page.
__previousPage | Private slot to go to the previous page.
__reload | Private slot to reload the current PDF document.
__restoreViewerState | Private method to restore the PDF Viewer state data.
__saveRecent | Private method to save the list of recently opened files.
__saveViewerState | Private method to save the PDF Viewer state data.
__search | Private slot to initiate a search.
__setCurrentFile | Private method to register the file name of the current file.
__setDisplayMode | Private method to set the display mode iaw.
__setViewerTitle | Private method to set the viewer title.
__showDocumentProperties | Private slot to open a dialog showing the document properties.
__showFileMenu | Private slot to modify the file menu before being shown.
__showPreferences | Private slot to set the preferences.
__showRecentMenu | Private slot to set up the recent files menu.
__startDocument | Private slot to go to the first page of the document.
__tocActivated | Private slot to handle the selection of a ToC topic.
__toggleFullScreen | Private slot to toggle the full screen mode.
__toggleOpenRecentNew | Private slot to toggle the 'Open Recent File in New Window' action.
__toggleSideBar | Private slot to togle the sidebar (info) widget.
__whatsThis | Private slot called in to enter Whats This mode.
__zoomIn | Private slot to zoom into the view.
__zoomModeChanged | Private slot to handle a change of the zoom mode.
__zoomOut | Private slot to zoom out of the view.
__zoomPageWidth | Private slot to fit the page width.
__zoomReset | Private slot to reset the zoom factor of the view.
__zoomWholePage | Private slot to fit the page width.
closeEvent | Protected method handling the close event.

### Static Methods

None

#### PdfViewerWindow (Constructor)

PdfViewerWindow(fileName="", parent=None, fromEric=False, project=None)

Constructor

fileName (str)
  name of a file to load on startup
parent (QWidget)
  parent widget of this window
fromEric (bool)
  flag indicating whether it was called from within eric
project (Project)
  reference to the project object

#### PdfViewerWindow.__about

__about()

Private slot to show a little About message.

#### PdfViewerWindow.__aboutQt

__aboutQt()

Private slot to handle the About Qt dialog.

#### PdfViewerWindow.__addToRecentList

__addToRecentList(fileName)

Private method to add a file name to the list of recently opened files.

fileName (str)
  name of the file to be added

#### PdfViewerWindow.__backInHistory

__backInHistory()

Private slot to go back in the view history.

#### PdfViewerWindow.__checkActions

__checkActions()

Private slot to check some actions for their enable/disable status.

#### PdfViewerWindow.__clearRecent

__clearRecent()

Private method to clear the list of recently opened files.

#### PdfViewerWindow.__closeAll

__closeAll()

Private slot to close all windows.

#### PdfViewerWindow.__closeOthers

__closeOthers()

Private slot to close all other windows.

#### PdfViewerWindow.__copyAllText

__copyAllText()

Private slot to copy all text of the document to the system clipboard.

#### PdfViewerWindow.__copyAllTextOfPage

__copyAllTextOfPage()

Private slot to copy all text of the current page to the system clipboard.

#### PdfViewerWindow.__copyText

__copyText()

Private slot to copy the selected text to the system clipboard.

#### PdfViewerWindow.__createStatusBar

__createStatusBar()

Private method to initialize the status bar.

#### PdfViewerWindow.__displayModeSelected

__displayModeSelected(act)

Private slot to handle the selection of a display mode.

act (QAction)
  reference to the triggering action

#### PdfViewerWindow.__endDocument

__endDocument()

Private slot to go to the last page of the document.

#### PdfViewerWindow.__forwardInHistory

__forwardInHistory()

Private slot to go forward in the view history.

#### PdfViewerWindow.__getErrorString

__getErrorString(err)

Private method to get an error string for the given error.

err (QPdfDocument.Error)
  error type

Return:
  string for the given error type

Return Type:
  str

#### PdfViewerWindow.__gotoPage

__gotoPage()

Private slot to show a dialog to select a page to jump to.

#### PdfViewerWindow.__handleSearchResult

__handleSearchResult(link)

Private slot to handle the selection of a search result.

link (QPdfLink)
  PDF link to navigate to

#### PdfViewerWindow.__initActions

__initActions()

Private method to define the user interface actions.

#### PdfViewerWindow.__initEditActions

__initEditActions()

Private method to create the Edit actions.

#### PdfViewerWindow.__initFileActions

__initFileActions()

Private method to define the file related user interface actions.

#### PdfViewerWindow.__initGotoActions

__initGotoActions()

Private method to define the navigation related user interface actions.

#### PdfViewerWindow.__initHelpActions

__initHelpActions()

Private method to create the Help actions.

#### PdfViewerWindow.__initMenus

__initMenus()

Private method to create the menus.

#### PdfViewerWindow.__initSettingsActions

__initSettingsActions()

Private method to create the Settings actions.

#### PdfViewerWindow.__initToolbars

__initToolbars()

Private method to create the toolbars.

#### PdfViewerWindow.__initViewActions

__initViewActions()

Private method to define the view related user interface actions.

#### PdfViewerWindow.__loadPdfFile

__loadPdfFile(fileName)

Private method to load a PDF file.

fileName (str)
  path of the PDF file to load

#### PdfViewerWindow.__loadRecent

__loadRecent()

Private method to load the list of recently opened files.

#### PdfViewerWindow.__nextPage

__nextPage()

Private slot to go to the next page.

#### PdfViewerWindow.__openPdfFile

__openPdfFile()

Private slot to open a PDF file.

#### PdfViewerWindow.__openPdfFileNewWindow

__openPdfFileNewWindow(fileName="")

Private slot called to open a PDF file in new viewer window.

fileName (str (optional))
  name of the file to open (defaults to "")

#### PdfViewerWindow.__openRecentPdfFile

__openRecentPdfFile(act)

Private method to open a file from the list of recently opened files.

act (QAction)
  reference to the action that triggered

#### PdfViewerWindow.__pageSelected

__pageSelected(page)

Private slot to navigate to the given page.

page (int)
  index of the page to be shown

#### PdfViewerWindow.__previousPage

__previousPage()

Private slot to go to the previous page.

#### PdfViewerWindow.__reload

__reload()

Private slot to reload the current PDF document.

#### PdfViewerWindow.__restoreViewerState

__restoreViewerState()

Private method to restore the PDF Viewer state data.

#### PdfViewerWindow.__saveRecent

__saveRecent()

Private method to save the list of recently opened files.

#### PdfViewerWindow.__saveViewerState

__saveViewerState()

Private method to save the PDF Viewer state data.

#### PdfViewerWindow.__search

__search()

Private slot to initiate a search.

#### PdfViewerWindow.__setCurrentFile

__setCurrentFile(fileName)

Private method to register the file name of the current file.

fileName (str)
  name of the file to register

#### PdfViewerWindow.__setDisplayMode

__setDisplayMode()

Private method to set the display mode iaw. configuration.

#### PdfViewerWindow.__setViewerTitle

__setViewerTitle(title)

Private method to set the viewer title.

title (str)
  title to be set

#### PdfViewerWindow.__showDocumentProperties

__showDocumentProperties()

Private slot to open a dialog showing the document properties.

#### PdfViewerWindow.__showFileMenu

__showFileMenu()

Private slot to modify the file menu before being shown.

#### PdfViewerWindow.__showPreferences

__showPreferences()

Private slot to set the preferences.

#### PdfViewerWindow.__showRecentMenu

__showRecentMenu()

Private slot to set up the recent files menu.

#### PdfViewerWindow.__startDocument

__startDocument()

Private slot to go to the first page of the document.

#### PdfViewerWindow.__tocActivated

__tocActivated(page, zoomFactor)

Private slot to handle the selection of a ToC topic.

page (int)
  page number
zoomFactor (float)
  zoom factor

#### PdfViewerWindow.__toggleFullScreen

__toggleFullScreen(on)

Private slot to toggle the full screen mode.

on (bool)
  flag indicating to activate full screen mode

#### PdfViewerWindow.__toggleOpenRecentNew

__toggleOpenRecentNew(on)

Private slot to toggle the 'Open Recent File in New Window' action.

on (bool)
  desired state of the action

#### PdfViewerWindow.__toggleSideBar

__toggleSideBar(visible)

Private slot to togle the sidebar (info) widget.

visible (bool)
  desired state of the sidebar

#### PdfViewerWindow.__whatsThis

__whatsThis()

Private slot called in to enter Whats This mode.

#### PdfViewerWindow.__zoomIn

__zoomIn()

Private slot to zoom into the view.

#### PdfViewerWindow.__zoomModeChanged

__zoomModeChanged(zoomMode)

Private slot to handle a change of the zoom mode.

zoomMode (QPdfView.ZoomMode)
  new zoom mode

#### PdfViewerWindow.__zoomOut

__zoomOut()

Private slot to zoom out of the view.

#### PdfViewerWindow.__zoomPageWidth

__zoomPageWidth(checked)

Private slot to fit the page width.

checked (bool)
  flag indicating the check state

#### PdfViewerWindow.__zoomReset

__zoomReset()

Private slot to reset the zoom factor of the view.

#### PdfViewerWindow.__zoomWholePage

__zoomWholePage(checked)

Private slot to fit the page width.

checked (bool)
  flag indicating the check state

#### PdfViewerWindow.closeEvent

closeEvent(evt)

Protected method handling the close event.

evt (QCloseEvent)
  reference to the close event

Up